﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace GUILibrary
{
    /// <summary>
    /// This component simply triggers whenever it is hovered.
    /// </summary>
    public class ImageActionOnHover : Component
    {
        /// <summary>
        /// The texture to display.
        /// </summary>
        public string TextureName
        {
            get;
            set;
        }

        private Texture2D texture;

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            batch.Draw(texture, ScreenPosition, Color.White);
        }

        public override void Load(Microsoft.Xna.Framework.Content.ContentManager cm)
        {
            texture = cm.Load<Texture2D>(TextureName);
        }

        protected override void ChangeHover(bool isHover)
        {
            base.ChangeHover(isHover);
            //only trigger if hovered.
            if (isHover)
                Triggered = true;
            else
                Triggered = false;
        }

        public override void UpdateMouseClick(Input.GameInput input)
        {
            //don't care about clicks, only trigger on hover.
            return;
        }
    }
}
